<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>1-私有属性</title>
</head>
<body>
    <script>
        class Person {
            // 公有属性
            name;
            // 私有属性
            #age;
            #weight;
            // 构造方法
            constructor(name, age, weight) {
                this.name = name;
                this.#age = age;
                this.#weight = weight
            }

            intro () {
                console.log(this.name);
                console.log(this.#age);
                console.log(this.#weight);

            }
        }

        const girl = new Person(`晓红`, 19, `45kg`);
        // console.log(girl.#age);
        // console.log(girl);
        girl.intro();
    </script>
</body>
</html>